package com.chinacreator.galaxylive.utils;

import com.chinacreator.galaxylive.bean.UserBean;

import javax.servlet.http.HttpServletRequest;

public class SessionUtils {

	private static final String USER_SESSION_ID = "session_user";
	private static final String APP_SESSION_ORG_ID = "session_org_id";
	
	public static UserBean getSessionUser(HttpServletRequest request){
		return (UserBean)request.getSession().getAttribute(USER_SESSION_ID);
	}
	
	public static void setUser(HttpServletRequest request,UserBean user){
		request.getSession().setAttribute(USER_SESSION_ID,user);
	}
	
	public static String getCurrentOrgId(HttpServletRequest request){
		return (String) request.getSession().getAttribute(APP_SESSION_ORG_ID);
	}
	
	public static void setCurrentOrgId(HttpServletRequest request,String orgId){
		request.getSession().setAttribute(APP_SESSION_ORG_ID,orgId);
	}
}
